﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;

namespace DemoGrid
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindGrid();
            }
        }
        private void BindGrid()
        {
            // Defining int variable to get the Total Record Count from Data layer
            int totalRecordCount = 0;

            EmployeeDAO objEmployeeDAO = new EmployeeDAO();

            IList<Employee> EmployeeList = objEmployeeDAO.GetEmployeeDetails(1, 200, out totalRecordCount);
            //Adding one empty row for just to show the grid
            if (EmployeeList.Count == 0)
                EmployeeList.Add(new Employee());

            grdEmployeeDtls.DataSource = EmployeeList;
            grdEmployeeDtls.DataBind();
        }
    }
}
